package com.zhike.service.file;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.springframework.web.multipart.MultipartFile;

import com.zhike.common.repository.FileUploadLog;

import java.util.HashMap;
import java.util.List;

public interface IFileService {
        /**
         * 用户头像上传接口
         *
         * @param request
         * @param response
         * @throws ServletException
         * @throws IOException
         */
        HashMap<String, Object> userAvatarUploader(MultipartFile file, String uid)
                        throws ServletException, IOException;

        /**
         * 群头像上传接口
         *
         * @param file
         * @param groupId
         * @return
         * @throws ServletException
         * @throws IOException
         */
        HashMap<String, Object> groupAvatarUploader(MultipartFile file, String userId, String groupId)
                        throws ServletException, IOException;

        /**
         * 个人照片文件上传接口
         *
         * @param request
         * @param response
         * @throws ServletException
         * @throws IOException
         */
        HashMap<String, Object> myPhotoUploader(MultipartFile file, String fileName)
                        throws ServletException, IOException;

        /**
         * 我的语音介绍中的音频文件上传
         *
         * @param request
         * @param response
         * @throws ServletException
         * @throws IOException
         */
        HashMap<String, Object> myVoiceUploader(MultipartFile file, String fileName)
                        throws ServletException, IOException;

        /**
         * 语音留言聊天消息的音频文件上传接口
         *
         * @param request
         * @param response
         * @throws ServletException
         * @throws IOException
         */
        HashMap<String, Object> msgVoiceUploader(MultipartFile file, String fileName)
                        throws ServletException, IOException;

        /**
         * 附件上传
         *
         * @param file
         * @param fileName
         * @throws ServletException
         * @throws IOException
         */
        HashMap<String, Object> fileAttachment(MultipartFile file, String fileName)
                        throws ServletException, IOException;

        /**
         * 图片聊天消息的图片文件上传接口
         *
         * @param request
         * @param response
         * @throws ServletException
         * @throws IOException
         */
        HashMap<String, Object> msgImageUploader(MultipartFile file, String uid)
                        throws ServletException, IOException;

        /**
         * 短视频文件上传接口
         *
         * @param request
         * @param response
         * @throws ServletException
         * @throws IOException
         */
        HashMap<String, Object> shortVideoUploader(MultipartFile file, String fileName)
                        throws ServletException, IOException;

        /**
         * 文件列表
         *
         * @return
         */
        List<FileUploadLog> selectMyFiles(String uid, String fileName);

        /**
         * 头像下载
         *
         * @param uid
         * @param res
         * @throws IOException
         */
        void userAvatarDown(String uid, HttpServletResponse res) throws IOException;

        /**
         * 群头像下载
         *
         * @param gid
         * @param res
         * @throws IOException
         */
        void groupAvatarDown(String gid, HttpServletResponse res) throws IOException;

        String getAttachmentDownloadUrl(String fileKey, HttpServletResponse res);
}
